﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;

namespace B2B.Models
{
    public class SP_ThemDonHang
    {
        int maBaoGia;

        public int MaBaoGia
        {
            get { return maBaoGia; }
            set { maBaoGia = value; }
        }
        int soLuongDat;

        public int SoLuongDat
        {
            get { return soLuongDat; }
            set { soLuongDat = value; }
        }
        double gia;

        public double Gia
        {
            get { return gia; }
            set { gia = value; }
        }

        public int ThemDonHang(SP_ThemDonHang donhang)
        {
            SqlConnection conn = KetNoi.Connection();
            SqlCommand cmd = new SqlCommand("SP_THEMDONHANG", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@MABAOGIA", donhang.MaBaoGia);
            cmd.Parameters.AddWithValue("@SOLUONGDAT", donhang.SoLuongDat);
            cmd.Parameters.AddWithValue("@GIA", donhang.Gia);
            conn.Open();
            int kq = cmd.ExecuteNonQuery();
            conn.Close();
            return kq;
        }

    }
}